package ichubcache

import (
	"gitee.com/ichub/goconfig/common/base/baseiface"
	"gitee.com/ichub/goconfig/common/basedi"
	"github.com/sirupsen/logrus"
)

/*
	@Title   文件名称: meta_cache_init.go
	@Desp    描述:    自动注册注入
    @Company 公司:    www.ichub.com

	@Author  作者:    leijmdas@163.com  时间: 2024-08-12 09:28:41
	@Update  作者:    leijmdas@163.com  时间: 2024-08-12 09:28:41
*/

var singleNameMetaCache = "*metacache.MetaCache-5179a6be-3b2c-4a9d-b46c-47ac95f4af8e"

// init register load
func init() {
	registerBeanMetaCache()
}

// register MetaCache
func registerBeanMetaCache() {
	basedi.RegisterLoadBean(singleNameMetaCache, LoadMetaCache)
}

// FindBeanMetaCache
func FindBeanMetaCache() *MetaCache {

	if bean, ok := basedi.FindBeanOk(singleNameMetaCache); ok {
		return bean.(*MetaCache)
	}

	logrus.Error("not find bean!")
	return nil
}

func LoadMetaCache() baseiface.ISingleton {
	var inst = NewMetaCache()
	InjectMetaCache(inst)
	return inst

}

func InjectMetaCache(s *MetaCache) {

	//logrus.Info("inject")
}
